﻿Imports System.Data.OleDb
Imports DTO
Public Class HocSinhDao
    Public Shared Function LayDSHocSinh() As DataTable
        Dim cn As OleDbConnection = DataProvider.ConnectDB()
        Dim sql = "Select MaHS,TenHS from HOCSINH"
        Dim cmd As New OleDbCommand(sql, cn)
        Dim dt As DataTable = New DataTable()
        Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)
        da.Fill(dt)
        cn.Close()
        Return dt
    End Function
    Public Shared Function LayHS_MaLop(ByVal MaLop As Integer) As DataTable
        Dim cn As OleDbConnection = DataProvider.ConnectDB()
        Dim sql = "Select hs.MaHS,hs.TenHS from HOCSINH hs,DANHSACHLOP dsl where dsl.MaHS=hs.MaHS and dsl.MaLop=?"
        Dim cmd As New OleDbCommand(sql, cn)
        cmd.Parameters.Add("@MaLop", OleDbType.Integer)
        cmd.Parameters("@MaLop").Value = MaLop
        Dim dt As New DataTable()
        Dim da As New OleDbDataAdapter(cmd)
        da.Fill(dt)
        cn.Close()
        Return dt
    End Function
End Class
